<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="loyin">
    <link rel="shortcut icon" href="/s/images/favicon_1.ico">
    <title>后台管理</title>
    <link href="/s/admin/css/responsive.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="/s/js/validator/jquery.validator.css"/>
    <link charset="utf-8" rel="stylesheet" href="/s/admin/css/login.css" media="all">
    <style type="text/css">
        body {
            opacity: 1;
            background-image: url(/s/images/admin/login/bg7.jpg);
            background-size: cover;
            background-repeat: no-repeat;
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
<div class="login login-modern login-position">
    <form id="loginForm" class="ui-form" onsubmit="return false">
        <fieldset>
            <h2 class="ui-form-title">欢迎登录管理后台</h2>
            <div class="ui-form-item ui-form-item-focus">
                <label class="ui-label"> <span
                        class="ui-icon ui-icon-userDEF">账户名：</span>
                </label> <input type="text" class="ui-input ui-input-normal"
                                name="username" id="username" type="text" autofocus="autofocus" autocomplete="off"
                                tabindex="1" maxlength="100" placeholder="登录账号">
            </div>

            <div class="ui-form-item ui-form-item-focus">
                <label class="ui-label"> <span
                        class="ui-icon ui-icon-securityON">登录密码：</span>
                </label> <input type="password" class="ui-input ui-input-normal"
                                name="password" id="password" type="password" min-length="6" autocomplete="off" tabindex="2"
                                maxlength="20" placeholder="登录密码">
            </div>
            <#if useCaptcha==true>
            <div class="ui-form-item ui-form-item-focus">
                <label class="ui-label"> <span
                        class="ui-icon ui-icon-securityON">验证码：</span>
                </label> <input type="text" class="ui-input ui-input-normal" style="width:50px;"
                                name="vcode" id="vcode" autocomplete="off" tabindex="3"
                                maxlength="4" placeholder="验证码">
                <div style="width:100px;height:38px;padding:0px;margin-right:6px;float:right">
                    <img id="captcha-img" src="/admin/captcha?d=" id="captcha-img" height="39px" style="cursor:pointer" title="点击获取新的图片" onclick="this.src='/admin/captcha?d='+new Date();">
                </div>
            </div>
            </#if>
            <div class="ui-form-text" id="alertMsg" style="color: #FFCC00; font-weight: bold;display:none;">
                提示：</div>
            <div class="ui-form-item ui-form-item-30pd">
                <a href="javascript:login();"
                       class="ui-button" tabindex="4">登   录</a>
                <p class="ui-form-other">
                    <a class="register" href="javascript:void(0);" style="color: #fff;">忘记密码?</a>
                </p>
                <#--
                <p class="ui-form-other">
                    <span class="login_text">其他帐号登录：</span> <a class="login_qq"
                                                               href="javascript:void(0);" onclick='toLogin("qq")' title="qq登录"></a>
                    <a class="login_baidu" href="javascript:void(0);"
                       onclick='toLogin("baidu")' title="百度登录"></a>
                    <a class="login_sina" href="javascript:void(0);" onclick='toLogin("sina")' title="新浪登录"></a>
                    <a class="register" href="javascript:void(0);" target="_blank"
                       title="注册" tabindex="8" onclick="toRegist();return false;">注册</a>
                </p>
                -->
            </div>
        </fieldset>
    </form>
</div>
</body>
<script src="/s/js/jquery.min.js"></script>
<script type="text/javascript">
    function showMsg(msg){
        $("#alertMsg").show().empty().html("提示:"+msg);
    }
    function login(){
        if($("#username").val()==''){
            showMsg("登录账号必填!");
            $("#username").focus();
            return;
        }
        if($("#password").val()==''){
            showMsg("登录密码必填!");
            $("#password").focus();
            return;
        }<#if useCaptcha==true>
        if($("#vcode").val()==''){
            showMsg("验证码必填!");
            $("#vcode").focus();
            return;
        }
        </#if>
        $.ajax({url:'/admin/login',data:$("#loginForm").serialize(),dataType:'json',type:'POST',success:function(json){
            if(json.code=='111'){
                window.location.href="/admin/main";
            }else{
                if(json.msg)
                    $("#alertMsg").show().empty().html("提示:"+json.msg);
                <#if useCaptcha==true>
            $("#captcha").click();
            </#if>
                $("#password").val("");
                $("#vcode").val("");
            }
        },error:function(e){

        }});
    }
    $(function(){
        $("body").keydown(function(event) {
            if (event.which == 13) {
                login();
            }
        });
        <#if useCaptcha==true>
        $("#captcha").click(function(){
            $("#captcha-img").attr("src","/admin/captcha?d="+new Date());
        });
        </#if>
    });
</script>

</html>